define(['main', 'metisMenu'], function(){

    // MetsiMenu
    $('#side-menu li:not(.nav-header)').removeClass('active');
    var nav = $('#side-menu .nav-sys');
    nav.addClass('active');
    nav.find('li').eq(4).addClass('active');
    $('#side-menu').metisMenu();

    /* Init DataTables 
    var oTable = $('#editable').dataTable({paging:false,searching:false,info: false});*/

    /* Apply the jEditable handlers to the table */
    /*oTable.$('td:not(.notEdit)').editable( '/t', {
        "callback": function( sValue, y ) {
            sValue = JSON.parse(sValue);
            var aPos = oTable.fnGetPosition( this );
            if(aPos[1] == 0){
                sValue = sValue.data.name;
            }else if(aPos[1] == 1){
                sValue = sValue.data.num;
            }
            oTable.fnUpdate( sValue, aPos[0], aPos[1] );
        },
        "submitdata": function ( value, settings ) {

            return {
                "row_id": this.parentNode.getAttribute('id'),
                "column": oTable.fnGetPosition( this )[2]
            };
        },

        "width": "90%",
        "height": "100%"
    });
    var pageNum = $("#pageNum").val();
    var count = $("#pageNum").attr('count');*/

    $('#confirmModal').on('click', '.okBtn', function(event) {

        var tag_id = del_tag_id;
        var params = {
            tag_id:tag_id
        }
        $.get(delTagUrl, params, function(data, textStatus, xhr) {

            var $tips = $('#tipsModal');
            $tips.modal('show');
            if(data.ret == 0){
                $tips.find('.modal-body').html('删除成功');
                $('#tipsModal').on('click', '.close', function(event) {
                    window.location.href = window.location.href;
                });
            }else{
                $tips.find('.modal-body').html('删除失败');
            }
        });
    }).on('click', '.cancelBtn', function(event) {
        event.preventDefault();
    });



    $('.ibox-content').on('keydown', '.tag_search', function(event) {
        
        if(event.keyCode == 13){
            event.preventDefault();
            var tagName = $(this).val();
            window.location.href = '/admin/sys2014/tag_info_query/'+tagName;
        }
        
    }).on('click', '.tagName a.r', function(event) {
        del_tag_id = $(this).attr('tid');
    });


    $('#is_show').on('change', function(event) {
       
        window.location.href = '/admin/sys2014/tag_list/14/?is_show='+$(this).val();
    });

    updata_point= function (tag_id,node){
        var point = $(node).val();
        $.post("/admin/sys2014/updata_point",{'tag_id':tag_id,'point':point},function(data){
           alert(data.msg);
        },"json");

    };   
    window.son_tag_list = function (tag_id){
        $("#son_tag_list_div").html("");
        $("div.modal-backdrop").remove();
        $.get("/admin/sys2014/son_tag_list?p_id="+tag_id,function(data){
           $("#son_tag_list_div").html(data);
           $("#son_tag_list").modal();

        });

    };
    /*.on('click', '#addRowBtn', function(event) {
        event.preventDefault();
        $('#editable').dataTable().fnAddData([
            "",
            "New row",
            "New row",
            "New row",
        ]);
        oTable.find('tr:not(.gradeX) td').eq(0).addClass('notEdit');
        oTable.$('td:not(.notEdit)').editable( '/t', {
            "callback": function( sValue, y ) {
                console.log(1,sValue, y);
                var aPos = oTable.fnGetPosition( this );
                oTable.fnUpdate( sValue, aPos[0], aPos[1] );
            },
            "submitdata": function ( value, settings ) {
                console.log(2,value, settings);
                return {
                    "row_id": this.parentNode.getAttribute('id'),
                    "column": oTable.fnGetPosition( this )[2]
                };
            },
    
            "width": "90%",
            "height": "100%"
        });
    });*/
    

});